﻿using System;
using System.Threading.Tasks;
namespace NFinal
{
    /// <summary>
    /// Action接口类
    /// </summary>
    public interface IAction
    {
        string GetRequestHeader(string key);
        /// <summary>
        /// 设置请求头
        /// </summary>
        /// <param name="key"></param>
        /// <param name="value"></param>
        void SetResponseHeader(string key,string value);
        /// <summary>
        /// 设置请求头
        /// </summary>
        /// <param name="key"></param>
        /// <param name="value"></param>
        void SetResponseHeader(string key, string[] value);
        /// <summary>
        /// 设置状态码
        /// </summary>
        /// <param name="statusCode"></param>
        void SetResponseStatusCode(int statusCode);
        /// <summary>
        /// 模板渲染前函数，用于子类重写
        /// </summary>
        void Before();
        /// <summary>
        /// 输出字节流
        /// </summary>
        /// <param name="buffer"></param>
        /// <param name="start"></param>
        /// <param name="cout"></param>
        void Write(byte[] buffer, int start, int cout);
        /// <summary>
        /// 模板渲染后函数，用于子类重写
        /// </summary>
        void After();
        /// <summary>
        /// 关闭资源
        /// </summary>
        void Close();
    }
}
